package com.banach.prema.web;


import com.banach.prema.dto.vo.ImTokenVO;
import com.banach.prema.service.ImService;
import com.ego.framework.annotation.Module;
import com.ego.framework.annotation.RestApi;
import com.ego.framework.dto.Response;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.Map;

/**
 * @author ajun
 *
 */
@RestController
@Module("IM")
@RequestMapping(value = "/im")
public class ImController {
	@Resource
	private ImService imService;

	@RestApi(name = "获取IM令牌",idx = 0)
	@GetMapping(value="/token")
	public Response<ImTokenVO> getImToken(){
		return imService.genImToken();
	}
	@PostMapping(value="/callback")
	@RestApi(name = "回调",idx = 1)
	public Map execute(HttpServletRequest request) throws IOException {
		return imService.callback(request);
	}
}
